<extend name="Public/base"/>

<block name="style">
	<link rel="stylesheet" href="__STATIC__/plugins/data-tables/DT_bootstrap.css" />
</block>

<block name="body">
    
    <div class="row">
        <div class="col-md-12">
            <!-- BEGIN EXAMPLE TABLE PORTLET-->
            <div class="portlet box green">
                <div class="portlet-title">
                    <div class="caption"><i class="fa fa-globe"></i>插件列表</div>
                    <div class="tools">
                        <a href="javascript:;" class="collapse"></a>
                        <a href="#portlet-config" data-toggle="modal" class="config"></a>
                        <a href="javascript:;" class="reload"></a>
                    </div>
                </div>
                <div class="portlet-body">
                    <div class="table-toolbar">
                        <div class="btn-group">
                            <a class="btn green" href="{:U('create')}">快速创建</a>
                        </div>
                    </div>
                    <table class="table table-striped table-bordered table-hover" id="sample">
                        <thead>
                            <tr>
                                <th>名称</th>
                                <th>标识</th>
                                <th >描述</th>
                                <th>状态</th>
                                <th>作者</th>
                                <th>版本</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            
                            <volist name="_list" id="vo">
                            <tr class="odd gradeX">
                                <td>{$vo.title}</td>
                                <td>{$vo.name}</td>
                                <td>{$vo.description}</td>
                                <td>{$vo.status_text|default="未安装"}</td>
                                <td><a target="_blank" href="{$vo.url|default='http://www.onethink.cn'}">{$vo.author}</a></td>
                                <td>{$vo.version}</td>
                                <td>
                                    <empty name="vo.uninstall">
                                        <?php
                                            $class	= get_addon_class($vo['name']);
                                            if(!class_exists($class)){
                                                $has_config = 0;
                                            }else{
                                                $addon = new $class();
                                                $has_config = count($addon->getConfig());
                                            }
                                        ?>
                                        <?php if ($has_config): ?>
                                            <a href="{:U('config',array('id'=>$vo['id']))}">设置</a>
                                        <?php endif ?>
                                    <?php if ($vo['status'] >=0): ?>
                                        <eq name="vo.status" value="0">
                                            <a class="ajax-get" href="{:U('enable',array('id'=>$vo['id']))}">启用</a>
                                        <else />
                                            <a class="ajax-get" href="{:U('disable',array('id'=>$vo['id']))}">禁用</a>
                                        </eq>
                                    <?php endif ?>
                                        {// <eq name="vo.author" value="thinkphp">}
                                            <a class="ajax-get" href="{:U('uninstall?id='.$vo['id'])}">卸载</a>
                                        {// </eq>}
                                    <else />
                                        <a class="ajax-get" href="{:U('install?addon_name='.$vo['name'])}">安装</a>
                                    </empty>
                                </td>
                            </tr>
                            </volist>
                        </tbody>
                    </table>
    
                    <!-- 分页 -->
                    <div class="page">
                        {$_page}
                    </div>
                </div>
            </div>
            <!-- END EXAMPLE TABLE PORTLET-->
        </div>
    </div>
</block>

<block name="script">
	<!-- BEGIN PAGE LEVEL PLUGINS -->
	<script type="text/javascript" src="__STATIC__/plugins/data-tables/jquery.dataTables.js"></script>
	<script type="text/javascript" src="__STATIC__/plugins/data-tables/DT_bootstrap.js"></script>
	<!-- END PAGE LEVEL PLUGINS -->
	<!-- BEGIN PAGE LEVEL SCRIPTS -->
	<script src="__STATIC__/scripts/app.js"></script>
	<script src="__STATIC__/scripts/table-managed.js"></script>     
	<script>
		jQuery(document).ready(function() {       
		   App.init();
		   TableManaged.init();
		});
	</script>
</block>